import { Http } from "../utils/http";

class Activity {
    /**
     * 获取首页推荐活动
     */
    static async getRecommendActivity(data) {
        return await Http.request({ url: 'activity/recommend', data })
    }

    /**
     * 删除活动信息
     */
    static async deleteActivityOrder(data) {
        return await Http.request({url: 'activity/order',data,type:"DELETE"})
    }

    /**
     * 获取官方活动
     */
    static async getGfActivity(data) {
        return await Http.request({ url: 'activity/gf', data })
    }

    /**
     * 获取官方活动详情
     */
    static async getGfActivityInfo(id) {
        return await Http.request({ url: `activity/gf/${id}`})
    }

    /**
     * 创建官方活动订单
     */
    static async createGfActivityOrder(id) {
        return await Http.request({ url: 'activity/gf', type:"POST", data: { id: id}})
    }

    /**
     * 获取商家信息
     */
    static async getSjMsg(data) {
        return await Http.request({ url: 'activity/sj-msg', data })
    }

    /**
     * 获取商家详情活动列表
     */
    static async getSjMsgInfo(id, data) {
        return await Http.request({ url: `activity/sj-msg/${id}`, data})
    }

    /**
     * 获取商家活动详情
     */
    static async getSjActivityInfo(id) {
        return await Http.request({ url: `activity/sj/${id}`})
    }

    /**
     * 创建商家活动订单
     */
    static async createSjActivityOrder(data) {
        return await Http.request({ url: 'activity/sj', type:"POST", data: data})
    }

    /**
     * 获取个人活动
     */
    static async getGrActivity(data) {
        return await Http.request({ url: 'activity/gr', data })
    }

    /**
     * 获取个人活动详情
     */
    static async getGrActivityInfo(id) {
        return await Http.request({ url: `activity/gr/${id}`})
    }

    /**
     * 创建个人活动信息
     */
    static async  createGrActivity(data, type) {
        return await Http.request({ url: 'activity/gr', data: data, type: type })
    }

    /**
     * 创建个人活动订单信息
     */
    static async  createGrActivityOrder(id) {
        return await Http.request({ url: 'activity/gr/order', data: {id: id}, type: "POST" })
    }

    /**
     * 删除个人活动订单
     */
    static async deleteGrActivityOrder(id) {
        return await Http.request({ url: 'activity/gr/order', data: {id: id}, type: "DELETE" })
    }


    /**
     * 获取订单列表
     */
    static async getActivityOrder(){
        return await Http.request({ url: 'activity/order' })
    }

    /**
     * 获取个人创建活动列表
     */
    static async getGrActivityUser(){
        return await Http.request({ url: 'activity/gr-activity' });
    }
}

export {
    Activity
}
